<%@ include file="/common/taglibs.jsp"%>
<head>
	<title><fmt:message key="order.title"/></title>
	<script type="text/javascript" src="<c:url value='/ext/scripts/index/index.js'/>"></script>
</head>
<script type="text/javascript"
	src="<c:url value='/ext/scripts/display/displaypage.js'/>">
</script>
<script>
jQuery(function(){
		jQuery("#displayallpage").val(${displayallpage});
		jQuery("#tz").val(${thispage});
	});
</script>
<div class="box_big">

<form:form commandName="order" method="post" action="${ctx}/orderinfo/orderform.html?method=query">


       <div class="tabbiao">
			<div class="r">
				<div class="con">
					<div style="float: left; width: 100%; margin: 0; padding: 0;" onclick="hiddenselectcon();">
						<h6>
							<fmt:message key="order.selectcon" />
						</h6>
					</div>
				</div>
			</div>
		</div>
	<div  onclick="hiddenselectcon();"></div>
	<div class="tabcon" id="selectcondiv" style="display: none;">
	<table border="0" cellspacing="0" cellpadding="0" class="table_surch">
		<tr>
			<th><fmt:message key="product.sateline"/>:</th>
			<td>
				<form:select path="satelliteid" id="satelliteid" cssClass="text4" cssStyle="width:80px;">
					<option value=""><fmt:message key="common.pleaseselect"/></option>
					<c:forEach var="s" items="${satelites}">
						<form:option value="${s}">${s}</form:option>
					</c:forEach>
				</form:select>
			</td>
			<th><fmt:message key="ordermodel.sensorid"/>:</th>
			<td>
				<form:select path="sensorid" id="sensorid" cssClass="text4" cssStyle="width:80px;">
					<option value=""><fmt:message key="common.pleaseselect"/></option>
					<c:forEach var="se" items="${sensors}">
						<form:option value="${se}" id="old">${se}</form:option>
					</c:forEach>
				</form:select>
			</td>
			<th><fmt:message key="order.sceneid"/>:</th>
			<td><form:input path="sceneid" cssClass="text3" cssStyle="width:70px;"/></td>
			<th><fmt:message key="order.productlevel"/>:</th>
			<td>
			<form:select path="productlevel" cssClass="text4" cssStyle="width:80px;">
				<option value=""><fmt:message key="common.pleaseselect"/></option>
				<c:forEach var="s" items="${productlevelsmap}">
					<form:option value="${s.key}">${s.value}</form:option>
				</c:forEach>
			</form:select>
			</td>
		</tr>
		<tr>
			<th><fmt:message key="order.checkstate"/>:</th>
			<td>
				<form:select path="areadystate" cssClass="text4" cssStyle="width:80px;">
					<option value=""><fmt:message key="common.pleaseselect"/></option>
					<c:forEach var="ch" items="${checkstatus}">
						<form:option value="${ch.key}">${ch.value}</form:option>
					</c:forEach>
				</form:select>
			</td>
			<th><fmt:message key="order.orderid"/>:</th>
			<td><form:input path="orderid" cssClass="text3" cssStyle="width:80px;"/></td>
			<th><fmt:message key="order.orderstate"/>:</th>
			<td>
				<form:select path="orderstate" cssClass="text4" cssStyle="width:80px;">
					<option value=""><fmt:message key="common.pleaseselect"/></option>
					<c:forEach var="o" items="${orderstatus}">
						<form:option value="${o.key}">${o.value}</form:option>
					</c:forEach>
				</form:select>
			</td>
			<shiro:hasRole name="admin">
				<th><fmt:message key="order.username"/>:</th>
				<td><form:input path="username" id="username" cssClass="text3"  cssStyle="width:80px;"/></td>
			</shiro:hasRole>
		</tr>
		<tr>
			<th><fmt:message key="order.ordertime"/>:</th>
			<td colspan="3">
				<form:input path="orderstarttime" id="orderstarttime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',lang:'${lang}'})" cssClass="Wdate text3" cssStyle="width:120px;"/>
				<fmt:message key="order.to"/>
				<form:input path="orderendtime" id="orderendtime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',lang:'${lang}'});" cssClass="Wdate text3" cssStyle="width:120px;"/>
			</td>
			<th><fmt:message key="order.checktime"/>:</th>
			<td colspan="3">
				<form:input path="checkstarttime" id="checkstarttime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',lang:'${lang}'});" cssClass="Wdate text3" cssStyle="width:120px;"/>
				<fmt:message key="order.to"/>
				<form:input path="checkendtime" id="checkendtime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',lang:'${lang}'});" cssClass="Wdate text3" cssStyle="width:120px;"/>
			</td>
			<td>
		         <input type="submit" value="" class="btn_search" />
            </td>
		</tr>
	</table>
	
</div>
<div class=""><!--
<div class="r">
<div class="con">
<shiro:hasPermission name="clearcount">
<input type="button" value="<fmt:message key="order.balance"/>" class="btn_bluem" onclick="payfor();"/>
</shiro:hasPermission>
<a href="#" onclick="shopcover();"><input type="button" value="<fmt:message key="shopcar.showcoverage"/>" class="btn_bluem"/></a>
</div>
--></div>
</div>
</form:form>
<form id="deleteform" method="post">
<input type="hidden" name="ptmeth" value="${ptmeth}"/>
<input type="hidden" name="tz" value="${thispage}"/>
</form>
<form id="balanceform" method="post" action="" name="orders">
<input type="hidden" id="orderid" id="orderid" value=""/>
<fmt:message key="shopcar.selectall"/><input type="checkbox" onclick="selectAll('ordername')">
<display:table name="orderlist" cellspacing="0" cellpadding="0" requestURI="" id="orders" pagesize="${pagesize}" export="true" style="width:100%;" class="table_display" size="${resultSize}" partialList="true">
	<display:column  style="border-left:1px solid #feb808;">
		<c:if test="${localuser ne orders.username}">
			<input type="checkbox" name="ordername" value="${orders.orderid}" onclick="selectColumn();" disabled="true"/>
		</c:if>
		<c:if test="${localuser eq orders.username}">
			<input type="checkbox" name="ordername" value="${orders.orderid}" onclick="selectColumn();"/>
		</c:if>
	</display:column>
	<display:column titleKey="order.orderid" sortable="true">
		<a href="${ctx}/orderinfo/orderform.html?method=details&orderid=${orders.orderid}">${orders.orderid}</a>
	</display:column>
	
	<%--
	<display:column titleKey="order.tasktype" sortable="true">
		<c:forEach var="t" items="${ordertypelistmap}">
			<c:if test="${orders.tasktype eq t.key}">${t.value}</c:if>
		</c:forEach>
	</display:column>
	 --%>
	<%-- 
	<display:column titleKey="order.priority" sortable="true">
		<c:forEach var="t" items="${prioritylistmap}">
			<c:if test="${orders.priority eq t.key}">${t.value}</c:if>
		</c:forEach>
	</display:column>--%>
	
	<display:column titleKey="order.checkstate" sortable="true" style="border-right:1px solid #feb808;">
		<c:forEach var="p" items="${checkstatus}">
			<c:if test="${orders.areadystate eq p.key}">${p.value}</c:if>
		</c:forEach>
    </display:column>
	<display:column property="username" titleKey="order.username" sortable="true" />
	<display:column property="satelliteid" titleKey="order.satelliteid" sortable="true" maxLength="12"/>
	<display:column property="sensorid" titleKey="order.sensorid" sortable="true" maxLength="12"/>
	<display:column property="orderid"  titleKey="order.sceneid" sortable="true" paramProperty="orderid">
	
	<%--<a href="${ctx}/scene/sceneview.html?method=view&sceneid=${orders.sceneid}&productid=${orders.productid}&productlevel=${orders.productlevel}&satelliteid=${orders.satelliteid}&sensorid=${orders.sensorid}&tasktype=${orders.tasktype}" target="_blank">${orders.sceneid}</a>
	--%></display:column>
	<display:column titleKey="order.producttype" sortable="true">
		<c:forEach var="p" items="${producttypemap}">
			<c:if test="${orders.producttype eq p.key}">${p.value}</c:if>
		</c:forEach>
	</display:column>
	<display:column titleKey="order.productlevel" sortable="true">
		<c:forEach var="pl" items="${productlevelsmap}">
			<c:if test="${orders.productlevel!= null && orders.productlevel eq pl.key}">
				${pl.value}
			</c:if>
		</c:forEach>
	</display:column>
	<%--
	<display:column property="tasktime" titleKey="order.ordertime" sortable="true" format="{0,date,yyyy-MM-dd HH:mm:ss}" maxLength="10"/>
	 --%>
	
	<display:column property="checktime" titleKey="order.checktime" sortable="true" format="{0,date,yyyy-MM-dd HH:mm:ss}" maxLength="10"/>
	<%--<display:column titleKey="order.orderstate" sortable="true">
		<c:forEach var="p" items="${orderstatus}">
			<c:if test="${orders.orderstate eq p.key}">${p.value}</c:if>
		</c:forEach>
	</display:column>
	 --%>
	<display:column titleKey="order.downurl" sortable="true" media="">
		<%--<shiro:hasPermission name="downloadAuthoriy">--%>
		<c:if test="${orders.orderstate!=null && orders.orderstate eq '1'}"><a href="${orders.productuploaddir}" target="_blank"><fmt:message key="order.downurl"/></a></c:if>
		<%--</shiro:hasPermission>--%>
	
	</display:column>
	<display:column titleKey="button.delete" sortable="true" media="">
	<a onclick="deleteornot(<c:out value="${orders.orderid}"/>)"> <fmt:message
						key="button.delete" /> </a>
	
		
	</display:column>
	<%-- <display:column titleKey="order.operate" media="html">
		<c:if test="${localuser eq orders.username}">
			<a href="#" onclick="javascript:location.href='orderform.html?method=reorder&id=${orders.orderid}'"><fmt:message key="ordermodel.reconorder"/></a>
		</c:if>
		<shiro:hasPermission name="reOrderAuthoriy">
		<c:if test="${localuser ne orders.username}">
			<fmt:message key="ordermodel.reconorder"/>
		</c:if>
		</shiro:hasPermission>
	</display:column>
	--%><display:setProperty name="export.pdf" value="false" />
	<display:setProperty name="export.csv" value="false" />
	<display:setProperty name="export.xml" value="false" />
	
</display:table>
</form>
</div>
<script type="text/javascript">
    highlightTableRows("orders");
    function selectAll(select){ 
	  o=document.getElementsByName(select);
	  var orderid = "";
	  for(i=0;i<o.length;i++)
	  {
		  if(o[i].disabled!=true)
		  {
			o[i].checked=event.srcElement.checked;
			if(orderid=="")
			{
				orderid = o[i].value;
			}
			else
			{
				orderid += "," + o[i].value;
			}
		  }
	   }
	   document.getElementById("orderid").value=orderid;
    }
    function onDelete(id)
    {
    	var msg = "<fmt:message key="shopcar.deletemsg"/>";
    	ans = confirm(msg);
    	if(ans)
   		{
	    	var form = document.getElementById("deleteform");
	    	form.action = "${ctx}/product/shopcar.html?method=save&operate=delete&id="+id;
	    	form.submit();
   		}
    }
    
    function changeview()
    {
    	var t = document.getElementById("ordercontable");
    	if(t.style.display=='block')
    	{
    		t.style.display='none';
    	}
    	else
    	{
    		t.style.display='block';
    	}
    }
    
    function selectColumn()
    {
    	var checkboxlist = document.getElementsByName("ordername");
    	document.getElementById("orderid").value="";
    	var orderid = "";
    	for(var i=0;i<checkboxlist.length;i++)
   		{
   			if(checkboxlist[i].checked)
 			{
 				if(orderid=="")
 				{
 					orderid = checkboxlist[i].value;
 				}
 				else
 				{
 					orderid += "," + checkboxlist[i].value;
 				}
 			}
   		}
    	document.getElementById("orderid").value=orderid;
    }
    
    function payfor()
    {
    	var form = document.getElementById("balanceform");
    	var orderid = document.getElementById("orderid").value;
    	form.action = "${ctx}/orderinfo/orderform.html?method=payfor&orderid="+orderid;
    	form.submit();
    }
</script>

<script type="text/javascript">
jQuery(function () {
 //select Listener
 jQuery("#satelliteid").change(function(){
  	var checkText=jQuery("#satelliteid").find("option:selected").text();  
 	jQuery.post("${ctx}/ajax/getsensors.html",{key:checkText},function(data){
 		try {
 			jQuery("#sensorid option[id='old']").remove();  //delete select's options
 			jQuery.each(data.ingredients,function(idx,item){  
 				jQuery("#sensorid").append("<option id='old' >"+item+"</option>");  //select add option
 			 	//alert(idx+item);
            	if(idx==0){      
            		return true;//return false is break  
            		}      
              });  
         } catch(e)
         {
            alert("Error in XML response:"+e);  
         }  
 	},'JSON');
 });   
});
	
function shopcover()
{
	var orderid = document.getElementById("orderid").value;
	window.open("${ctx}/shopcar/shopcar.html?method=cover&viewmethod=order&orderid="+orderid,"_blank");
}
</script>
<script type="text/javascript">
//highlightTableRows("users");
function deleteornot(str) {
	
	var del_str = "<fmt:message key='collect.delete_or_not'/>";

if (!confirm(del_str)) {
	}else{
		window.location = "${ctx}/orderinfo/orderform.html?method=delete&orderid="+str+"&tz="+${thispage};
	}
}
</script>





